package com.ari.actions;

import org.apache.log4j.Logger;

import com.devicemantra.coordinate.dao.Settings;
import com.devicemantra.coordinate.dao.SettingsDAO;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class EPPDViewServerForEditAction {

	static final Logger logger = Logger
			.getLogger(EPPDViewServerForEditAction.class);

	@Expose
	@SerializedName("eppd_server")
	Settings eppdServerSettings = null;
	private String eppdServerName;
	private SettingsDAO settingsDAO;

	public void setEppdServerName(final String eppdServerName) {
		this.eppdServerName = eppdServerName;
	}

	/**
	 * @return
	 */
	public String execute() {
		try {
			Thread.sleep(1000);
		} catch (final InterruptedException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		/* Query the db now */
		try {
			eppdServerSettings = settingsDAO.getSetting(eppdServerName);
		} catch (final Exception e) {
			System.out.println("Rolling back");
			e.printStackTrace();
		}
		return "json";
	}

	public void validate() {
	}

	public void setSettingsDAO(final SettingsDAO settingsDAO) {
		this.settingsDAO = settingsDAO;
	}

}
